package com.zyj.zdelayed;

import io.github.spitmaster.warlock.annotation.Warlock;
import io.github.spitmaster.warlock.enums.Scope;
import io.github.spitmaster.zdelayed.annotation.DelayTime;
import io.github.spitmaster.zdelayed.annotation.Zdelayed;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.time.Duration;


@SpringBootApplication
public class ZdelayedStandalone {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ZdelayedStandalone.class, args);
        ZdelayedStandalone zdelayedStandalone = context.getBean(ZdelayedStandalone.class);
        zdelayedStandalone.a();
        zdelayedStandalone.b();
    }

    @Zdelayed
    public void a() {
        System.out.println("a");
    }

    @Warlock(name = "2", lockScope = Scope.DISTRIBUTED)
    public void b() {
        System.out.println("b");
    }

    @Zdelayed
    public void b(@DelayTime Duration delayTime) {
        System.out.println("bb");
    }

    @Zdelayed
    public void c(@DelayTime Long delayTime) {
        System.out.println("cc");
    }

}
